cmake_minimum_required(VERSION 3.10)
project(test)
add_definitions("--std=c++11")
set(CMAKE_BUILD_TYPE "release")

find_package(OpenCV)

set(EVDEPLOY_INC "/usr/local/evdeploy/include")
set(EVDPLOY_LIB_PATH "/usr/local/evdeploy/lib")

include_directories(${OpenCV_INCLUDE_DIRS})

link_directories(${EVDPLOY_LIB_PATH})
set(OPENCV_LIB opencv_core opencv_imgproc opencv_imgcodecs)


add_executable(test_yolov5 test_yolov5.cpp)
target_link_libraries(test_yolov5 glog pthread evdeploy ${OPENCV_LIB} ${RUNTIME_LIBS})
set_target_properties(test_yolov5 PROPERTIES LINK_FLAGS "-Wl,--disable-new-dtags,-rpath,${EVDPLOY_LIB_PATH}")
install(TARGETS test_yolov5 DESTINATION ${CMAKE_SOURCE_DIR}/bin/)

add_executable(test_plate_ocr test_plate_ocr.cpp)
target_link_libraries(test_plate_ocr glog pthread evdeploy ${OPENCV_LIB} ${RUNTIME_LIBS})
set_target_properties(test_plate_ocr PROPERTIES LINK_FLAGS "-Wl,--disable-new-dtags,-rpath,${EVDPLOY_LIB_PATH}")
install(TARGETS test_plate_ocr DESTINATION ${CMAKE_SOURCE_DIR}/bin/)

add_executable(test_plate_det test_plate_det.cpp)
target_link_libraries(test_plate_det glog pthread evdeploy ${OPENCV_LIB} ${RUNTIME_LIBS})
set_target_properties(test_plate_det PROPERTIES LINK_FLAGS "-Wl,--disable-new-dtags,-rpath,${EVDPLOY_LIB_PATH}")
install(TARGETS test_plate_det DESTINATION ${CMAKE_SOURCE_DIR}/bin/)

add_executable(test_person test_person_det.cpp)
target_link_libraries(test_person glog pthread evdeploy ${OPENCV_LIB} ${RUNTIME_LIBS})
set_target_properties(test_person PROPERTIES LINK_FLAGS "-Wl,--disable-new-dtags,-rpath,${EVDPLOY_LIB_PATH}")
install(TARGETS test_person DESTINATION ${CMAKE_SOURCE_DIR}/bin/)

if(WITH_TENSORRT_RUNTIME)
    add_executable(test_custom_trt_infer test_custom_trt_infer.cpp)
    target_include_directories(test_custom_trt_infer PUBLIC ${evauth_INCLUDE_DIRS} ${RUNTIME_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
    target_link_libraries(test_custom_trt_infer PRIVATE ${evauth_LIBS} ${RUNTIME_LIBS} ${OpenCV_LIBS} evdeploy)
    set_target_properties(test_custom_trt_infer PROPERTIES LINK_FLAGS "-Wl,--disable-new-dtags,-rpath,${EVDPLOY_LIB_PATH}")
    install(TARGETS test_custom_trt_infer DESTINATION ${CMAKE_SOURCE_DIR}/bin/)
endif()

add_executable(test_yolov8 test_yolov8.cpp)
target_link_libraries(test_yolov8 glog pthread evdeploy ${OPENCV_LIB} ${RUNTIME_LIBS})
set_target_properties(test_yolov8 PROPERTIES LINK_FLAGS "-Wl,--disable-new-dtags,-rpath,${EVDPLOY_LIB_PATH}")
install(TARGETS test_yolov8 DESTINATION ${CMAKE_SOURCE_DIR}/bin/)

add_executable(test_yoloworld test_yoloworld.cpp)
target_link_libraries(test_yoloworld glog pthread evdeploy ${OPENCV_LIB} ${RUNTIME_LIBS})
set_target_properties(test_yoloworld PROPERTIES LINK_FLAGS "-Wl,--disable-new-dtags,-rpath,${EVDPLOY_LIB_PATH}")
install(TARGETS test_yoloworld DESTINATION ${CMAKE_SOURCE_DIR}/bin/)